<?php
    $name = '';
    $group = 0;
    $order = '';
    $display = 1;
    if(isset($info) && count($info)>0){
        $name = $info['category_name'];
        $group = $info['category_parent_id'];
        $order = $info['category_order'];
        $display = $info['category_display_state'];
    }
    if($this->input->post('submit')){
        $name = $this->input->post('name');
        $group = $this->input->post('group');
        $order = $this->input->post('order');
        $display = $this->input->post('display');
    }
?>
<div class="module">
    <h2><span><?= $subtitle ?></span></h2>
    <div class="module-body">
        <?= form_open()?>
            <div>
                <?= $message ?>
            </div>
            <p>
                <label>Tên danh mục</label>
                <input type="text" class="input-short" name="name" value="<?= $name ?>" />
                <?=form_error('name'); ?>
            </p>
            <p>
                <label>Nhóm danh mục </label>
                <select class="input-short" name="group">
                    <option value="0">--- Không thuộc nhóm nào ---</option>
                    <?php
                        $html = '<option value="%d" %s>%s</option>';
                        echo Create_Multi_Menu(0,$list,$html,$group);
                    ?>
                </select>
            </p>
            <p>
                <label>Thứ tự hiển thị</label>
                <input type="text" class="input-short" name="order" value="<?= $order ?>"  />
                <?=form_error('order'); ?>
            </p>
            <fieldset>
                <legend>Cho phép hiển thị</legend>
                <ul>
                    <li><label><input type="radio" name="display" <?php if($display==1): ?> checked="checked" <?php endif ?> value="1" /> Có</label></li>
                    <li><label><input type="radio" name="display" <?php if($display==0): ?> checked="checked" <?php endif ?> value="0" />Không</label></li>
                </ul>
            </fieldset>
            <fieldset>
                <input class="submit-green" type="submit" value="Thực hiện" name="submit" />
                <input class="submit-gray" type="button" value="Xoá" name="cancel" />
            </fieldset>
        <?= form_close()?>
    </div> <!-- End .module-body -->
</div>
